package com.tianji.learning.controller;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * @author Xinxuan Zhuo
 * @version 2024/2/27
 * <p>
 *
 * </p>
 */

@Api(tags = "互动提问的问题相关接口（管理端）")
@RestController
@RequestMapping("/admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService questionService;

    /**
     * 管理端分页查询互动问题
     */
    @ApiOperation("管理端分页查询互动问题")
    @GetMapping("/page")
    public PageDTO<QuestionAdminVO> queryQuestionPageAdmin(QuestionAdminPageQuery query){
        return questionService.queryQuestionPageAdmin(query);
    }

    /**
     * 管理端隐藏或者显示问题
     */
    @ApiOperation("管理端隐藏或者显示问题")
    @PutMapping("/{id}/hidden/{hidden}")
    public void changeQuestionHidden(@PathVariable Long id, @PathVariable Boolean hidden){
        questionService.changeQuestionHidden(id, hidden);
    }

    /**
     * 管理端根据id查询问题详情
     */
    @ApiOperation("管理端根据id查询问题详情")
    @GetMapping("/{id}")
    public QuestionAdminVO queryQuestionByIdInAdmin(@PathVariable Long id){
        return questionService.queryQuestionByIdInAdmin(id);
    }


}
